<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('ERP提取')" />

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form " action="">
                    <br>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">编号</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" lay-verify="required" name="sono" id="sono"
                                       placeholder="请输入编号"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width: auto">订单类型</label>
                            <div class="layui-input-inline">
                                <select name="sotype" id="sotype">
                                    <option value="">全部</option>
                                    <option value="140">库存调拨单</option>
                                    <option value="104">领料出库单</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" jq-filter="submit" lay-submit="" lay-filter="addERP">立即提取</button>
                        </div>
                    </div>

                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

    })

</script>
<script>
    layui.use(['myform','zzpUtils','form','jquery'],function () {
        var form = layui.form,
            zzpUtils = layui.zzpUtils,
            $ = layui.jquery;

        form.on("submit(addERP)",function(data){
            if($('#sotype').val()==''){
                layer.msg("订单类型是必填项", {icon: 5,shift: 6});
            }else {
                zzpUtils.confirm("是否确定提取", function (index) {
                    zzpUtils.action({
                        url: "/orderInterfaceController/save",
                        data: JSON.stringify(data.field),
                        success: function (data) {
                            if (data.type == 'success') {
                                top.layer.msg(data.title);
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            } else {
                                layer.confirm(data.backmsg, {btn: ['确定'], title: data.title, icon: 2});
                            }
                        }, error: function (xhr, textStatus) {
                            console.log(textStatus);
                            console.log(xhr);
                        }
                    })
                })
            }
            return false;
        });
    });
</script>
</html>